
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module gdata.tlslite.TLSRecordLayer</title>
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="gdata.html"><font color="#ffffff">gdata</font></a>.<a href="gdata.tlslite.html"><font color="#ffffff">tlslite</font></a>.TLSRecordLayer</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/usr/local/google/home/afshar/src/external-gdata-release/google3/src/gdata/tlslite/TLSRecordLayer.py">/usr/local/google/home/afshar/src/external-gdata-release/google3/src/gdata/tlslite/TLSRecordLayer.py</a></font></td></tr></table>
    <p><tt>Helper&nbsp;class&nbsp;for&nbsp;TLSConnection.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
    
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="Crypto.html">Crypto</a><br>
<a href="array.html">array</a><br>
<a href="base64.html">base64</a><br>
<a href="binascii.html">binascii</a><br>
</td><td width="25%" valign=top><a href="errno.html">errno</a><br>
<a href="gdata.tlslite.utils.hmac.html">gdata.tlslite.utils.hmac</a><br>
<a href="math.html">math</a><br>
<a href="md5.html">md5</a><br>
</td><td width="25%" valign=top><a href="os.html">os</a><br>
<a href="sha.html">sha</a><br>
<a href="socket.html">socket</a><br>
<a href="sys.html">sys</a><br>
</td><td width="25%" valign=top><a href="traceback.html">traceback</a><br>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
    
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="gdata.tlslite.TLSRecordLayer.html#TLSRecordLayer">TLSRecordLayer</a>
</font></dt></dl>
 <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="TLSRecordLayer">class <strong>TLSRecordLayer</strong></a></font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>This&nbsp;class&nbsp;handles&nbsp;data&nbsp;transmission&nbsp;for&nbsp;a&nbsp;TLS&nbsp;connection.<br>
&nbsp;<br>
Its&nbsp;only&nbsp;subclass&nbsp;is&nbsp;L{tlslite.TLSConnection.TLSConnection}.&nbsp;&nbsp;We've<br>
separated&nbsp;the&nbsp;code&nbsp;in&nbsp;this&nbsp;class&nbsp;from&nbsp;TLSConnection&nbsp;to&nbsp;make&nbsp;things<br>
more&nbsp;readable.<br>
&nbsp;<br>
&nbsp;<br>
@type&nbsp;sock:&nbsp;socket.socket<br>
@ivar&nbsp;sock:&nbsp;The&nbsp;underlying&nbsp;socket&nbsp;object.<br>
&nbsp;<br>
@type&nbsp;session:&nbsp;L{tlslite.Session.Session}<br>
@ivar&nbsp;session:&nbsp;The&nbsp;session&nbsp;corresponding&nbsp;to&nbsp;this&nbsp;connection.<br>
&nbsp;<br>
Due&nbsp;to&nbsp;TLS&nbsp;session&nbsp;resumption,&nbsp;multiple&nbsp;connections&nbsp;can&nbsp;correspond<br>
to&nbsp;the&nbsp;same&nbsp;underlying&nbsp;session.<br>
&nbsp;<br>
@type&nbsp;version:&nbsp;tuple<br>
@ivar&nbsp;version:&nbsp;The&nbsp;TLS&nbsp;version&nbsp;being&nbsp;used&nbsp;for&nbsp;this&nbsp;connection.<br>
&nbsp;<br>
(3,0)&nbsp;means&nbsp;SSL&nbsp;3.0,&nbsp;and&nbsp;(3,1)&nbsp;means&nbsp;TLS&nbsp;1.0.<br>
&nbsp;<br>
@type&nbsp;closed:&nbsp;bool<br>
@ivar&nbsp;closed:&nbsp;If&nbsp;this&nbsp;connection&nbsp;is&nbsp;closed.<br>
&nbsp;<br>
@type&nbsp;resumed:&nbsp;bool<br>
@ivar&nbsp;resumed:&nbsp;If&nbsp;this&nbsp;connection&nbsp;is&nbsp;based&nbsp;on&nbsp;a&nbsp;resumed&nbsp;session.<br>
&nbsp;<br>
@type&nbsp;allegedSharedKeyUsername:&nbsp;str&nbsp;or&nbsp;None<br>
@ivar&nbsp;allegedSharedKeyUsername:&nbsp;&nbsp;This&nbsp;is&nbsp;set&nbsp;to&nbsp;the&nbsp;shared-key<br>
username&nbsp;asserted&nbsp;by&nbsp;the&nbsp;client,&nbsp;whether&nbsp;the&nbsp;handshake&nbsp;succeeded&nbsp;or<br>
not.&nbsp;&nbsp;If&nbsp;the&nbsp;handshake&nbsp;fails,&nbsp;this&nbsp;can&nbsp;be&nbsp;inspected&nbsp;to<br>
determine&nbsp;if&nbsp;a&nbsp;guessing&nbsp;attack&nbsp;is&nbsp;in&nbsp;progress&nbsp;against&nbsp;a&nbsp;particular<br>
user&nbsp;account.<br>
&nbsp;<br>
@type&nbsp;allegedSrpUsername:&nbsp;str&nbsp;or&nbsp;None<br>
@ivar&nbsp;allegedSrpUsername:&nbsp;&nbsp;This&nbsp;is&nbsp;set&nbsp;to&nbsp;the&nbsp;SRP&nbsp;username<br>
asserted&nbsp;by&nbsp;the&nbsp;client,&nbsp;whether&nbsp;the&nbsp;handshake&nbsp;succeeded&nbsp;or&nbsp;not.<br>
If&nbsp;the&nbsp;handshake&nbsp;fails,&nbsp;this&nbsp;can&nbsp;be&nbsp;inspected&nbsp;to&nbsp;determine<br>
if&nbsp;a&nbsp;guessing&nbsp;attack&nbsp;is&nbsp;in&nbsp;progress&nbsp;against&nbsp;a&nbsp;particular&nbsp;user<br>
account.<br>
&nbsp;<br>
@type&nbsp;closeSocket:&nbsp;bool<br>
@ivar&nbsp;closeSocket:&nbsp;If&nbsp;the&nbsp;socket&nbsp;should&nbsp;be&nbsp;closed&nbsp;when&nbsp;the<br>
connection&nbsp;is&nbsp;closed&nbsp;(writable).<br>
&nbsp;<br>
If&nbsp;you&nbsp;set&nbsp;this&nbsp;to&nbsp;True,&nbsp;TLS&nbsp;Lite&nbsp;will&nbsp;assume&nbsp;the&nbsp;responsibility&nbsp;of<br>
closing&nbsp;the&nbsp;socket&nbsp;when&nbsp;the&nbsp;TLS&nbsp;Connection&nbsp;is&nbsp;shutdown&nbsp;(either<br>
through&nbsp;an&nbsp;error&nbsp;or&nbsp;through&nbsp;the&nbsp;user&nbsp;calling&nbsp;<a href="#TLSRecordLayer-close">close</a>()).&nbsp;&nbsp;The&nbsp;default<br>
is&nbsp;False.<br>
&nbsp;<br>
@type&nbsp;ignoreAbruptClose:&nbsp;bool<br>
@ivar&nbsp;ignoreAbruptClose:&nbsp;If&nbsp;an&nbsp;abrupt&nbsp;close&nbsp;of&nbsp;the&nbsp;socket&nbsp;should<br>
raise&nbsp;an&nbsp;error&nbsp;(writable).<br>
&nbsp;<br>
If&nbsp;you&nbsp;set&nbsp;this&nbsp;to&nbsp;True,&nbsp;TLS&nbsp;Lite&nbsp;will&nbsp;not&nbsp;raise&nbsp;a<br>
L{tlslite.errors.TLSAbruptCloseError}&nbsp;exception&nbsp;if&nbsp;the&nbsp;underlying<br>
socket&nbsp;is&nbsp;unexpectedly&nbsp;closed.&nbsp;&nbsp;Such&nbsp;an&nbsp;unexpected&nbsp;closure&nbsp;could&nbsp;be<br>
caused&nbsp;by&nbsp;an&nbsp;attacker.&nbsp;&nbsp;However,&nbsp;it&nbsp;also&nbsp;occurs&nbsp;with&nbsp;some&nbsp;incorrect<br>
TLS&nbsp;implementations.<br>
&nbsp;<br>
You&nbsp;should&nbsp;set&nbsp;this&nbsp;to&nbsp;True&nbsp;only&nbsp;if&nbsp;you're&nbsp;not&nbsp;worried&nbsp;about&nbsp;an<br>
attacker&nbsp;truncating&nbsp;the&nbsp;connection,&nbsp;and&nbsp;only&nbsp;if&nbsp;necessary&nbsp;to&nbsp;avoid<br>
spurious&nbsp;errors.&nbsp;&nbsp;The&nbsp;default&nbsp;is&nbsp;False.<br>
&nbsp;<br>
@sort:&nbsp;__init__,&nbsp;read,&nbsp;readAsync,&nbsp;write,&nbsp;writeAsync,&nbsp;close,&nbsp;closeAsync,<br>
getCipherImplementation,&nbsp;getCipherName<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="TLSRecordLayer-__init__"><strong>__init__</strong></a>(self, sock)</dt></dl>

<dl><dt><a name="TLSRecordLayer-close"><strong>close</strong></a>(self)</dt><dd><tt>Close&nbsp;the&nbsp;TLS&nbsp;connection.<br>
&nbsp;<br>
This&nbsp;function&nbsp;will&nbsp;block&nbsp;until&nbsp;it&nbsp;has&nbsp;exchanged&nbsp;close_notify<br>
alerts&nbsp;with&nbsp;the&nbsp;other&nbsp;party.&nbsp;&nbsp;After&nbsp;doing&nbsp;so,&nbsp;it&nbsp;will&nbsp;shut&nbsp;down&nbsp;the<br>
TLS&nbsp;connection.&nbsp;&nbsp;Further&nbsp;attempts&nbsp;to&nbsp;read&nbsp;through&nbsp;this&nbsp;connection<br>
will&nbsp;return&nbsp;"".&nbsp;&nbsp;Further&nbsp;attempts&nbsp;to&nbsp;write&nbsp;through&nbsp;this&nbsp;connection<br>
will&nbsp;raise&nbsp;ValueError.<br>
&nbsp;<br>
If&nbsp;<a href="#TLSRecordLayer-makefile">makefile</a>()&nbsp;has&nbsp;been&nbsp;called&nbsp;on&nbsp;this&nbsp;connection,&nbsp;the&nbsp;connection<br>
will&nbsp;be&nbsp;not&nbsp;be&nbsp;closed&nbsp;until&nbsp;the&nbsp;connection&nbsp;object&nbsp;and&nbsp;all&nbsp;file<br>
objects&nbsp;have&nbsp;been&nbsp;closed.<br>
&nbsp;<br>
Even&nbsp;if&nbsp;an&nbsp;exception&nbsp;is&nbsp;raised,&nbsp;the&nbsp;connection&nbsp;will&nbsp;have&nbsp;been<br>
closed.<br>
&nbsp;<br>
@raise&nbsp;socket.error:&nbsp;If&nbsp;a&nbsp;socket&nbsp;error&nbsp;occurs.<br>
@raise&nbsp;tlslite.errors.TLSAbruptCloseError:&nbsp;If&nbsp;the&nbsp;socket&nbsp;is&nbsp;closed<br>
without&nbsp;a&nbsp;preceding&nbsp;alert.<br>
@raise&nbsp;tlslite.errors.TLSAlert:&nbsp;If&nbsp;a&nbsp;TLS&nbsp;alert&nbsp;is&nbsp;signalled.</tt></dd></dl>

<dl><dt><a name="TLSRecordLayer-closeAsync"><strong>closeAsync</strong></a>(self)</dt><dd><tt>Start&nbsp;a&nbsp;close&nbsp;operation&nbsp;on&nbsp;the&nbsp;TLS&nbsp;connection.<br>
&nbsp;<br>
This&nbsp;function&nbsp;returns&nbsp;a&nbsp;generator&nbsp;which&nbsp;behaves&nbsp;similarly&nbsp;to<br>
<a href="#TLSRecordLayer-close">close</a>().&nbsp;&nbsp;Successive&nbsp;invocations&nbsp;of&nbsp;the&nbsp;generator&nbsp;will&nbsp;return&nbsp;0<br>
if&nbsp;it&nbsp;is&nbsp;waiting&nbsp;to&nbsp;read&nbsp;from&nbsp;the&nbsp;socket,&nbsp;1&nbsp;if&nbsp;it&nbsp;is&nbsp;waiting<br>
to&nbsp;write&nbsp;to&nbsp;the&nbsp;socket,&nbsp;or&nbsp;will&nbsp;raise&nbsp;StopIteration&nbsp;if&nbsp;the<br>
close&nbsp;operation&nbsp;has&nbsp;completed.<br>
&nbsp;<br>
@rtype:&nbsp;iterable<br>
@return:&nbsp;A&nbsp;generator;&nbsp;see&nbsp;above&nbsp;for&nbsp;details.</tt></dd></dl>

<dl><dt><a name="TLSRecordLayer-getCipherImplementation"><strong>getCipherImplementation</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;name&nbsp;of&nbsp;the&nbsp;cipher&nbsp;implementation&nbsp;used&nbsp;with<br>
this&nbsp;connection.<br>
&nbsp;<br>
@rtype:&nbsp;str<br>
@return:&nbsp;The&nbsp;name&nbsp;of&nbsp;the&nbsp;cipher&nbsp;implementation&nbsp;used&nbsp;with<br>
this&nbsp;connection.&nbsp;&nbsp;Either&nbsp;'python',&nbsp;'cryptlib',&nbsp;'openssl',<br>
or&nbsp;'pycrypto'.</tt></dd></dl>

<dl><dt><a name="TLSRecordLayer-getCipherName"><strong>getCipherName</strong></a>(self)</dt><dd><tt>Get&nbsp;the&nbsp;name&nbsp;of&nbsp;the&nbsp;cipher&nbsp;used&nbsp;with&nbsp;this&nbsp;connection.<br>
&nbsp;<br>
@rtype:&nbsp;str<br>
@return:&nbsp;The&nbsp;name&nbsp;of&nbsp;the&nbsp;cipher&nbsp;used&nbsp;with&nbsp;this&nbsp;connection.<br>
Either&nbsp;'aes128',&nbsp;'aes256',&nbsp;'rc4',&nbsp;or&nbsp;'3des'.</tt></dd></dl>

<dl><dt><a name="TLSRecordLayer-getpeername"><strong>getpeername</strong></a>(self)</dt><dd><tt>Return&nbsp;the&nbsp;remote&nbsp;address&nbsp;to&nbsp;which&nbsp;the&nbsp;socket&nbsp;is&nbsp;connected<br>
(socket&nbsp;emulation).</tt></dd></dl>

<dl><dt><a name="TLSRecordLayer-getsockname"><strong>getsockname</strong></a>(self)</dt><dd><tt>Return&nbsp;the&nbsp;socket's&nbsp;own&nbsp;address&nbsp;(socket&nbsp;emulation).</tt></dd></dl>

<dl><dt><a name="TLSRecordLayer-gettimeout"><strong>gettimeout</strong></a>(self)</dt><dd><tt>Return&nbsp;the&nbsp;timeout&nbsp;associated&nbsp;with&nbsp;socket&nbsp;operations&nbsp;(socket<br>
emulation).</tt></dd></dl>

<dl><dt><a name="TLSRecordLayer-makefile"><strong>makefile</strong></a>(self, mode<font color="#909090">='r'</font>, bufsize<font color="#909090">=-1</font>)</dt><dd><tt>Create&nbsp;a&nbsp;file&nbsp;object&nbsp;for&nbsp;the&nbsp;TLS&nbsp;connection&nbsp;(socket&nbsp;emulation).<br>
&nbsp;<br>
@rtype:&nbsp;L{tlslite.FileObject.FileObject}</tt></dd></dl>

<dl><dt><a name="TLSRecordLayer-read"><strong>read</strong></a>(self, max<font color="#909090">=None</font>, min<font color="#909090">=1</font>)</dt><dd><tt>Read&nbsp;some&nbsp;data&nbsp;from&nbsp;the&nbsp;TLS&nbsp;connection.<br>
&nbsp;<br>
This&nbsp;function&nbsp;will&nbsp;block&nbsp;until&nbsp;at&nbsp;least&nbsp;'min'&nbsp;bytes&nbsp;are<br>
available&nbsp;(or&nbsp;the&nbsp;connection&nbsp;is&nbsp;closed).<br>
&nbsp;<br>
If&nbsp;an&nbsp;exception&nbsp;is&nbsp;raised,&nbsp;the&nbsp;connection&nbsp;will&nbsp;have&nbsp;been<br>
automatically&nbsp;closed.<br>
&nbsp;<br>
@type&nbsp;max:&nbsp;int<br>
@param&nbsp;max:&nbsp;The&nbsp;maximum&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;return.<br>
&nbsp;<br>
@type&nbsp;min:&nbsp;int<br>
@param&nbsp;min:&nbsp;The&nbsp;minimum&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;return<br>
&nbsp;<br>
@rtype:&nbsp;str<br>
@return:&nbsp;A&nbsp;string&nbsp;of&nbsp;no&nbsp;more&nbsp;than&nbsp;'max'&nbsp;bytes,&nbsp;and&nbsp;no&nbsp;fewer<br>
than&nbsp;'min'&nbsp;(unless&nbsp;the&nbsp;connection&nbsp;has&nbsp;been&nbsp;closed,&nbsp;in&nbsp;which<br>
case&nbsp;fewer&nbsp;than&nbsp;'min'&nbsp;bytes&nbsp;may&nbsp;be&nbsp;returned).<br>
&nbsp;<br>
@raise&nbsp;socket.error:&nbsp;If&nbsp;a&nbsp;socket&nbsp;error&nbsp;occurs.<br>
@raise&nbsp;tlslite.errors.TLSAbruptCloseError:&nbsp;If&nbsp;the&nbsp;socket&nbsp;is&nbsp;closed<br>
without&nbsp;a&nbsp;preceding&nbsp;alert.<br>
@raise&nbsp;tlslite.errors.TLSAlert:&nbsp;If&nbsp;a&nbsp;TLS&nbsp;alert&nbsp;is&nbsp;signalled.</tt></dd></dl>

<dl><dt><a name="TLSRecordLayer-readAsync"><strong>readAsync</strong></a>(self, max<font color="#909090">=None</font>, min<font color="#909090">=1</font>)</dt><dd><tt>Start&nbsp;a&nbsp;read&nbsp;operation&nbsp;on&nbsp;the&nbsp;TLS&nbsp;connection.<br>
&nbsp;<br>
This&nbsp;function&nbsp;returns&nbsp;a&nbsp;generator&nbsp;which&nbsp;behaves&nbsp;similarly&nbsp;to<br>
<a href="#TLSRecordLayer-read">read</a>().&nbsp;&nbsp;Successive&nbsp;invocations&nbsp;of&nbsp;the&nbsp;generator&nbsp;will&nbsp;return&nbsp;0<br>
if&nbsp;it&nbsp;is&nbsp;waiting&nbsp;to&nbsp;read&nbsp;from&nbsp;the&nbsp;socket,&nbsp;1&nbsp;if&nbsp;it&nbsp;is&nbsp;waiting<br>
to&nbsp;write&nbsp;to&nbsp;the&nbsp;socket,&nbsp;or&nbsp;a&nbsp;string&nbsp;if&nbsp;the&nbsp;read&nbsp;operation&nbsp;has<br>
completed.<br>
&nbsp;<br>
@rtype:&nbsp;iterable<br>
@return:&nbsp;A&nbsp;generator;&nbsp;see&nbsp;above&nbsp;for&nbsp;details.</tt></dd></dl>

<dl><dt><a name="TLSRecordLayer-recv"><strong>recv</strong></a>(self, bufsize)</dt><dd><tt>Get&nbsp;some&nbsp;data&nbsp;from&nbsp;the&nbsp;TLS&nbsp;connection&nbsp;(socket&nbsp;emulation).<br>
&nbsp;<br>
@raise&nbsp;socket.error:&nbsp;If&nbsp;a&nbsp;socket&nbsp;error&nbsp;occurs.<br>
@raise&nbsp;tlslite.errors.TLSAbruptCloseError:&nbsp;If&nbsp;the&nbsp;socket&nbsp;is&nbsp;closed<br>
without&nbsp;a&nbsp;preceding&nbsp;alert.<br>
@raise&nbsp;tlslite.errors.TLSAlert:&nbsp;If&nbsp;a&nbsp;TLS&nbsp;alert&nbsp;is&nbsp;signalled.</tt></dd></dl>

<dl><dt><a name="TLSRecordLayer-send"><strong>send</strong></a>(self, s)</dt><dd><tt>Send&nbsp;data&nbsp;to&nbsp;the&nbsp;TLS&nbsp;connection&nbsp;(socket&nbsp;emulation).<br>
&nbsp;<br>
@raise&nbsp;socket.error:&nbsp;If&nbsp;a&nbsp;socket&nbsp;error&nbsp;occurs.</tt></dd></dl>

<dl><dt><a name="TLSRecordLayer-sendall"><strong>sendall</strong></a>(self, s)</dt><dd><tt>Send&nbsp;data&nbsp;to&nbsp;the&nbsp;TLS&nbsp;connection&nbsp;(socket&nbsp;emulation).<br>
&nbsp;<br>
@raise&nbsp;socket.error:&nbsp;If&nbsp;a&nbsp;socket&nbsp;error&nbsp;occurs.</tt></dd></dl>

<dl><dt><a name="TLSRecordLayer-setsockopt"><strong>setsockopt</strong></a>(self, level, optname, value)</dt><dd><tt>Set&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;given&nbsp;socket&nbsp;option&nbsp;(socket&nbsp;emulation).</tt></dd></dl>

<dl><dt><a name="TLSRecordLayer-settimeout"><strong>settimeout</strong></a>(self, value)</dt><dd><tt>Set&nbsp;a&nbsp;timeout&nbsp;on&nbsp;blocking&nbsp;socket&nbsp;operations&nbsp;(socket&nbsp;emulation).</tt></dd></dl>

<dl><dt><a name="TLSRecordLayer-write"><strong>write</strong></a>(self, s)</dt><dd><tt>Write&nbsp;some&nbsp;data&nbsp;to&nbsp;the&nbsp;TLS&nbsp;connection.<br>
&nbsp;<br>
This&nbsp;function&nbsp;will&nbsp;block&nbsp;until&nbsp;all&nbsp;the&nbsp;data&nbsp;has&nbsp;been&nbsp;sent.<br>
&nbsp;<br>
If&nbsp;an&nbsp;exception&nbsp;is&nbsp;raised,&nbsp;the&nbsp;connection&nbsp;will&nbsp;have&nbsp;been<br>
automatically&nbsp;closed.<br>
&nbsp;<br>
@type&nbsp;s:&nbsp;str<br>
@param&nbsp;s:&nbsp;The&nbsp;data&nbsp;to&nbsp;transmit&nbsp;to&nbsp;the&nbsp;other&nbsp;party.<br>
&nbsp;<br>
@raise&nbsp;socket.error:&nbsp;If&nbsp;a&nbsp;socket&nbsp;error&nbsp;occurs.</tt></dd></dl>

<dl><dt><a name="TLSRecordLayer-writeAsync"><strong>writeAsync</strong></a>(self, s)</dt><dd><tt>Start&nbsp;a&nbsp;write&nbsp;operation&nbsp;on&nbsp;the&nbsp;TLS&nbsp;connection.<br>
&nbsp;<br>
This&nbsp;function&nbsp;returns&nbsp;a&nbsp;generator&nbsp;which&nbsp;behaves&nbsp;similarly&nbsp;to<br>
<a href="#TLSRecordLayer-write">write</a>().&nbsp;&nbsp;Successive&nbsp;invocations&nbsp;of&nbsp;the&nbsp;generator&nbsp;will&nbsp;return<br>
1&nbsp;if&nbsp;it&nbsp;is&nbsp;waiting&nbsp;to&nbsp;write&nbsp;to&nbsp;the&nbsp;socket,&nbsp;or&nbsp;will&nbsp;raise<br>
StopIteration&nbsp;if&nbsp;the&nbsp;write&nbsp;operation&nbsp;has&nbsp;completed.<br>
&nbsp;<br>
@rtype:&nbsp;iterable<br>
@return:&nbsp;A&nbsp;generator;&nbsp;see&nbsp;above&nbsp;for&nbsp;details.</tt></dd></dl>

</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
    
<tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl><dt><a name="-sha1"><strong>sha1</strong></a> = openssl_sha1(...)</dt><dd><tt>Returns&nbsp;a&nbsp;sha1&nbsp;hash&nbsp;object;&nbsp;optionally&nbsp;initialized&nbsp;with&nbsp;a&nbsp;string</tt></dd></dl>
</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
    
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><strong>cryptlibpyLoaded</strong> = False<br>
<strong>generators</strong> = _Feature((2, 2, 0, 'alpha', 1), (2, 3, 0, 'final', 0), 0)<br>
<strong>gmpyLoaded</strong> = False<br>
<strong>goodGroupParameters</strong> = [(2, 167609434410335061...389658897350067939L), (2, 148699818592312829...022696100064262587L), (2, 217661744586174357...299250924469288819L), (2, 580960599536995806...769998514148343807L), (5, 104438888141315250...045385534758453247L), (5, 337515218214385611...109988915707117567L), (5, 109074813561941592...353154294858383359L)]<br>
<strong>m2cryptoLoaded</strong> = False<br>
<strong>prngName</strong> = 'os.urandom'<br>
<strong>pycryptoLoaded</strong> = True<br>
<strong>sieve</strong> = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, ...]</td></tr></table>
</body></html>